//
//  HomeOneSectionViewCell.m
//  Shengzhuli
//
//  Created by FXGuo on 2017/7/13.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "HomeOneSectionViewCell.h"
#import <UIImageView+WebCache.h>
#import <UIButton+WebCache.h>

@interface HomeOneSectionViewCell ()

@property (weak, nonatomic) IBOutlet UIButton *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UIImageView *bgImageView;
@property (weak, nonatomic) IBOutlet UILabel *tipsLab;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *iconConsW;

@property (strong, nonatomic) IBOutlet UIButton *PlayButton;
@property (weak, nonatomic) IBOutlet UIView *bottomView;

@end

@implementation HomeOneSectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.PlayButton.hidden = YES;
}
- (IBAction)PlayButtonClick:(id)sender {
    
    if (self.playBlock) {
        self.playBlock();
    }
}

- (void)setModel:(OldActivityModel *)model
{
    _model = model;
    self.titleLab.text = [NSString stringWithFormat:@"%@",model.title];
    self.tipsLab.text = [NSString stringWithFormat:@"浏览量:%zd",model.viewCount];
    [self.bgImageView sd_setImageWithURL:[NSURL URLWithString:[model.avatarUrl componentsSeparatedByString:@"#"].firstObject] placeholderImage:GetImage(@"default_goods_image")];
    if (self.isClub) {
        self.tipsLab.text = [NSString stringWithFormat:@"%@  浏览量:%zd",model.clubName,model.viewCount];
        [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.clubLogo] forState:UIControlStateNormal placeholderImage:GetImage(@"person_avatar")];
    }else {
        self.iconConsW.constant = 0.001;
    }
    if (model.videoUrl.length > 0) {
        self.PlayButton.hidden = NO;
        self.bottomView.hidden = NO;
    }else {
        self.PlayButton.hidden = YES;
        self.bottomView.hidden = YES;
    }
}

@end
